\(\int \frac {(d+e x)^2 (f+g x+h x^2)}{(a+b x+c x^2)^2} \, dx\) [155]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 30, antiderivative size = 288 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {e^2 \left (2 c^2 f-b c g+2 b^2 h-6 a c h\right ) x}{c^2 \left (b^2-4 a c\right )}+\frac {(d+e x)^2 \left (c \left (2 a g-b \left (f+\frac {a h}{c}\right )\right )-\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) x\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}+\frac {\left (4 c^4 d^2 f-2 b^4 e^2 h-6 a c^2 e (b e g+2 b d h+2 a e h)+b^2 c e (b e g+2 b d h+12 a e h)-c^3 \left (2 b d (2 e f+d g)-4 a \left (e^2 f+2 d e g+d^2 h\right )\right )\right ) \text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^3 \left (b^2-4 a c\right )^{3/2}}+\frac {e (c e g+2 c d h-2 b e h) \log \left (a+b x+c x^2\right )}{2 c^3} \]

[Out]

e^2*(2*c^2*f+2*b^2*h-c*(6*a*h+b*g))*x/c^2/(-4*a*c+b^2)+(e*x+d)^2*(c*(2*a*g-b*(f+a*h/c))-(-2*a*c*h+b^2*h-b*c*g+
2*c^2*f)*x)/c/(-4*a*c+b^2)/(c*x^2+b*x+a)+(4*c^4*d^2*f-2*b^4*e^2*h-6*a*c^2*e*(2*a*e*h+2*b*d*h+b*e*g)+b^2*c*e*(1
2*a*e*h+2*b*d*h+b*e*g)-c^3*(2*b*d*(d*g+2*e*f)-4*a*(d^2*h+2*d*e*g+e^2*f)))*arctanh((2*c*x+b)/(-4*a*c+b^2)^(1/2)
)/c^3/(-4*a*c+b^2)^(3/2)+1/2*e*(-2*b*e*h+2*c*d*h+c*e*g)*ln(c*x^2+b*x+a)/c^3

Rubi [A] (verified)

Time = 0.44 (sec) , antiderivative size = 288, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {1658, 787, 648, 632, 212, 642} \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {\text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (b^2 c e (12 a e h+2 b d h+b e g)-c^3 \left (2 b d (d g+2 e f)-4 a \left (d^2 h+2 d e g+e^2 f\right )\right )-6 a c^2 e (2 a e h+2 b d h+b e g)-2 b^4 e^2 h+4 c^4 d^2 f\right )}{c^3 \left (b^2-4 a c\right )^{3/2}}+\frac {(d+e x)^2 \left (c \left (2 a g-b \left (\frac {a h}{c}+f\right )\right )-x \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}+\frac {e^2 x \left (-6 a c h+2 b^2 h-b c g+2 c^2 f\right )}{c^2 \left (b^2-4 a c\right )}+\frac {e \log \left (a+b x+c x^2\right ) (-2 b e h+2 c d h+c e g)}{2 c^3} \]

[In]

Int[((d + e*x)^2*(f + g*x + h*x^2))/(a + b*x + c*x^2)^2,x]

[Out]

(e^2*(2*c^2*f - b*c*g + 2*b^2*h - 6*a*c*h)*x)/(c^2*(b^2 - 4*a*c)) + ((d + e*x)^2*(c*(2*a*g - b*(f + (a*h)/c))
- (2*c^2*f - b*c*g + b^2*h - 2*a*c*h)*x))/(c*(b^2 - 4*a*c)*(a + b*x + c*x^2)) + ((4*c^4*d^2*f - 2*b^4*e^2*h -
6*a*c^2*e*(b*e*g + 2*b*d*h + 2*a*e*h) + b^2*c*e*(b*e*g + 2*b*d*h + 12*a*e*h) - c^3*(2*b*d*(2*e*f + d*g) - 4*a*
(e^2*f + 2*d*e*g + d^2*h)))*ArcTanh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]])/(c^3*(b^2 - 4*a*c)^(3/2)) + (e*(c*e*g + 2*
c*d*h - 2*b*e*h)*Log[a + b*x + c*x^2])/(2*c^3)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 787

Int[(((d_.) + (e_.)*(x_))*((f_) + (g_.)*(x_)))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[e*g*(x/c
), x] + Dist[1/c, Int[(c*d*f - a*e*g + (c*e*f + c*d*g - b*e*g)*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c,
 d, e, f, g}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 1658

Int[(Pq_)*((d_.) + (e_.)*(x_))^(m_.)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = Polynomi
alQuotient[Pq, a + b*x + c*x^2, x], f = Coeff[PolynomialRemainder[Pq, a + b*x + c*x^2, x], x, 0], g = Coeff[Po
lynomialRemainder[Pq, a + b*x + c*x^2, x], x, 1]}, Simp[(d + e*x)^m*(a + b*x + c*x^2)^(p + 1)*((f*b - 2*a*g +
(2*c*f - b*g)*x)/((p + 1)*(b^2 - 4*a*c))), x] + Dist[1/((p + 1)*(b^2 - 4*a*c)), Int[(d + e*x)^(m - 1)*(a + b*x
 + c*x^2)^(p + 1)*ExpandToSum[(p + 1)*(b^2 - 4*a*c)*(d + e*x)*Q + g*(2*a*e*m + b*d*(2*p + 3)) - f*(b*e*m + 2*c
*d*(2*p + 3)) - e*(2*c*f - b*g)*(m + 2*p + 3)*x, x], x], x]] /; FreeQ[{a, b, c, d, e}, x] && PolyQ[Pq, x] && N
eQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && LtQ[p, -1] && GtQ[m, 0] && (IntegerQ[p] ||  !IntegerQ[m
] ||  !RationalQ[a, b, c, d, e]) &&  !(IGtQ[m, 0] && RationalQ[a, b, c, d, e] && (IntegerQ[p] || ILtQ[p + 1/2,
 0]))

Rubi steps \begin{align*} \text {integral}& = \frac {(d+e x)^2 \left (c \left (2 a g-b \left (f+\frac {a h}{c}\right )\right )-\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) x\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}+\frac {\int \frac {(d+e x) \left (2 c d f-2 b e f-b d g+4 a e g+2 a d h-\frac {2 a b e h}{c}-e \left (2 c f-b g-6 a h+\frac {2 b^2 h}{c}\right ) x\right )}{a+b x+c x^2} \, dx}{-b^2+4 a c} \\ & = \frac {e^2 \left (2 c^2 f-b c g+2 b^2 h-6 a c h\right ) x}{c^2 \left (b^2-4 a c\right )}+\frac {(d+e x)^2 \left (c \left (2 a g-b \left (f+\frac {a h}{c}\right )\right )-\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) x\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}-\frac {\int \frac {a e^2 \left (2 c f-b g-6 a h+\frac {2 b^2 h}{c}\right )+c d \left (2 c d f-2 b e f-b d g+4 a e g+2 a d h-\frac {2 a b e h}{c}\right )+\left (-c d e \left (2 c f-b g-6 a h+\frac {2 b^2 h}{c}\right )+b e^2 \left (2 c f-b g-6 a h+\frac {2 b^2 h}{c}\right )+c e \left (2 c d f-2 b e f-b d g+4 a e g+2 a d h-\frac {2 a b e h}{c}\right )\right ) x}{a+b x+c x^2} \, dx}{c \left (b^2-4 a c\right )} \\ & = \frac {e^2 \left (2 c^2 f-b c g+2 b^2 h-6 a c h\right ) x}{c^2 \left (b^2-4 a c\right )}+\frac {(d+e x)^2 \left (c \left (2 a g-b \left (f+\frac {a h}{c}\right )\right )-\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) x\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}+\frac {(e (c e g+2 c d h-2 b e h)) \int \frac {b+2 c x}{a+b x+c x^2} \, dx}{2 c^3}-\frac {\left (4 c^4 d^2 f-2 b^4 e^2 h-6 a c^2 e (b e g+2 b d h+2 a e h)+b^2 c e (b e g+2 b d h+12 a e h)-c^3 \left (2 b d (2 e f+d g)-4 a \left (e^2 f+2 d e g+d^2 h\right )\right )\right ) \int \frac {1}{a+b x+c x^2} \, dx}{2 c^3 \left (b^2-4 a c\right )} \\ & = \frac {e^2 \left (2 c^2 f-b c g+2 b^2 h-6 a c h\right ) x}{c^2 \left (b^2-4 a c\right )}+\frac {(d+e x)^2 \left (c \left (2 a g-b \left (f+\frac {a h}{c}\right )\right )-\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) x\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}+\frac {e (c e g+2 c d h-2 b e h) \log \left (a+b x+c x^2\right )}{2 c^3}+\frac {\left (4 c^4 d^2 f-2 b^4 e^2 h-6 a c^2 e (b e g+2 b d h+2 a e h)+b^2 c e (b e g+2 b d h+12 a e h)-c^3 \left (2 b d (2 e f+d g)-4 a \left (e^2 f+2 d e g+d^2 h\right )\right )\right ) \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c^3 \left (b^2-4 a c\right )} \\ & = \frac {e^2 \left (2 c^2 f-b c g+2 b^2 h-6 a c h\right ) x}{c^2 \left (b^2-4 a c\right )}+\frac {(d+e x)^2 \left (c \left (2 a g-b \left (f+\frac {a h}{c}\right )\right )-\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) x\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}+\frac {\left (4 c^4 d^2 f-2 b^4 e^2 h-6 a c^2 e (b e g+2 b d h+2 a e h)+b^2 c e (b e g+2 b d h+12 a e h)-c^3 \left (2 b d (2 e f+d g)-4 a \left (e^2 f+2 d e g+d^2 h\right )\right )\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^3 \left (b^2-4 a c\right )^{3/2}}+\frac {e (c e g+2 c d h-2 b e h) \log \left (a+b x+c x^2\right )}{2 c^3} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.48 (sec) , antiderivative size = 398, normalized size of antiderivative = 1.38 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {2 c e^2 h x-\frac {2 \left (b^4 e^2 h x+b^3 e (a e h-c (e g+2 d h) x)+b^2 c \left (c \left (e^2 f+2 d e g+d^2 h\right ) x-a e (e g+2 d h+4 e h x)\right )+2 c^2 \left (c^2 d^2 f x-a c \left (e^2 f x+2 d e (f+g x)+d^2 (g+h x)\right )+a^2 e (2 d h+e (g+h x))\right )+b c \left (-3 a^2 e^2 h+c^2 d (-2 e f x+d (f-g x))+a c \left (d^2 h+e^2 (f+3 g x)+2 d e (g+3 h x)\right )\right )\right )}{\left (b^2-4 a c\right ) (a+x (b+c x))}+\frac {2 \left (4 c^4 d^2 f-2 b^4 e^2 h-6 a c^2 e (b e g+2 b d h+2 a e h)+b^2 c e (b e g+2 b d h+12 a e h)+c^3 \left (-2 b d (2 e f+d g)+4 a \left (e^2 f+2 d e g+d^2 h\right )\right )\right ) \arctan \left (\frac {b+2 c x}{\sqrt {-b^2+4 a c}}\right )}{\left (-b^2+4 a c\right )^{3/2}}+e (c e g+2 c d h-2 b e h) \log (a+x (b+c x))}{2 c^3} \]

[In]

Integrate[((d + e*x)^2*(f + g*x + h*x^2))/(a + b*x + c*x^2)^2,x]

[Out]

(2*c*e^2*h*x - (2*(b^4*e^2*h*x + b^3*e*(a*e*h - c*(e*g + 2*d*h)*x) + b^2*c*(c*(e^2*f + 2*d*e*g + d^2*h)*x - a*
e*(e*g + 2*d*h + 4*e*h*x)) + 2*c^2*(c^2*d^2*f*x - a*c*(e^2*f*x + 2*d*e*(f + g*x) + d^2*(g + h*x)) + a^2*e*(2*d
*h + e*(g + h*x))) + b*c*(-3*a^2*e^2*h + c^2*d*(-2*e*f*x + d*(f - g*x)) + a*c*(d^2*h + e^2*(f + 3*g*x) + 2*d*e
*(g + 3*h*x)))))/((b^2 - 4*a*c)*(a + x*(b + c*x))) + (2*(4*c^4*d^2*f - 2*b^4*e^2*h - 6*a*c^2*e*(b*e*g + 2*b*d*
h + 2*a*e*h) + b^2*c*e*(b*e*g + 2*b*d*h + 12*a*e*h) + c^3*(-2*b*d*(2*e*f + d*g) + 4*a*(e^2*f + 2*d*e*g + d^2*h
)))*ArcTan[(b + 2*c*x)/Sqrt[-b^2 + 4*a*c]])/(-b^2 + 4*a*c)^(3/2) + e*(c*e*g + 2*c*d*h - 2*b*e*h)*Log[a + x*(b
+ c*x)])/(2*c^3)

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(627\) vs. \(2(283)=566\).

Time = 0.77 (sec) , antiderivative size = 628, normalized size of antiderivative = 2.18

method result size
default \(\frac {h \,e^{2} x}{c^{2}}-\frac {\frac {-\frac {\left (2 a^{2} c^{2} e^{2} h -4 a \,b^{2} c \,e^{2} h +6 a b \,c^{2} d e h +3 a b \,c^{2} e^{2} g -2 a \,c^{3} d^{2} h -4 a \,c^{3} d e g -2 a \,c^{3} e^{2} f +b^{4} e^{2} h -2 b^{3} c d e h -b^{3} c \,e^{2} g +b^{2} c^{2} d^{2} h +2 b^{2} c^{2} d e g +b^{2} c^{2} e^{2} f -b \,c^{3} d^{2} g -2 b \,c^{3} d e f +2 c^{4} d^{2} f \right ) x}{c \left (4 a c -b^{2}\right )}+\frac {3 a^{2} b c \,e^{2} h -4 a^{2} c^{2} d e h -2 a^{2} c^{2} e^{2} g -a \,b^{3} e^{2} h +2 a \,b^{2} c d e h +a \,b^{2} c \,e^{2} g -a b \,c^{2} d^{2} h -2 a b \,c^{2} d e g -a b \,c^{2} e^{2} f +2 a \,c^{3} d^{2} g +4 a \,c^{3} d e f -b \,c^{3} d^{2} f}{c \left (4 a c -b^{2}\right )}}{c \,x^{2}+b x +a}+\frac {\frac {\left (8 a b c \,e^{2} h -8 a \,c^{2} d h e -4 a \,c^{2} e^{2} g -2 b^{3} e^{2} h +2 b^{2} c d e h +b^{2} c \,e^{2} g \right ) \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {2 \left (6 a^{2} c \,e^{2} h -2 a \,b^{2} e^{2} h +2 a b c d e h +a b c \,e^{2} g -2 a \,c^{2} d^{2} h -4 a \,c^{2} d e g -2 a \,c^{2} e^{2} f +b \,c^{2} d^{2} g +2 b \,c^{2} d e f -2 c^{3} d^{2} f -\frac {\left (8 a b c \,e^{2} h -8 a \,c^{2} d h e -4 a \,c^{2} e^{2} g -2 b^{3} e^{2} h +2 b^{2} c d e h +b^{2} c \,e^{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-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1376 vs. \(2 (281) = 562\).

Time = 0.55 (sec) , antiderivative size = 2771, normalized size of antiderivative = 9.62 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\text {Too large to display} \]

[In]

integrate((e*x+d)^2*(h*x^2+g*x+f)/(c*x^2+b*x+a)^2,x, algorithm="fricas")

[Out]

[1/2*(2*(b^4*c^2 - 8*a*b^2*c^3 + 16*a^2*c^4)*e^2*h*x^3 + 2*(b^5*c - 8*a*b^3*c^2 + 16*a^2*b*c^3)*e^2*h*x^2 + ((
4*(c^5*d^2 - b*c^4*d*e + a*c^4*e^2)*f - (2*b*c^4*d^2 - 8*a*c^4*d*e - (b^3*c^2 - 6*a*b*c^3)*e^2)*g + 2*(2*a*c^4
*d^2 + (b^3*c^2 - 6*a*b*c^3)*d*e - (b^4*c - 6*a*b^2*c^2 + 6*a^2*c^3)*e^2)*h)*x^2 + 4*(a*c^4*d^2 - a*b*c^3*d*e
+ a^2*c^3*e^2)*f - (2*a*b*c^3*d^2 - 8*a^2*c^3*d*e - (a*b^3*c - 6*a^2*b*c^2)*e^2)*g + 2*(2*a^2*c^3*d^2 + (a*b^3
*c - 6*a^2*b*c^2)*d*e - (a*b^4 - 6*a^2*b^2*c + 6*a^3*c^2)*e^2)*h + (4*(b*c^4*d^2 - b^2*c^3*d*e + a*b*c^3*e^2)*
f - (2*b^2*c^3*d^2 - 8*a*b*c^3*d*e - (b^4*c - 6*a*b^2*c^2)*e^2)*g + 2*(2*a*b*c^3*d^2 + (b^4*c - 6*a*b^2*c^2)*d
*e - (b^5 - 6*a*b^3*c + 6*a^2*b*c^2)*e^2)*h)*x)*sqrt(b^2 - 4*a*c)*log((2*c^2*x^2 + 2*b*c*x + b^2 - 2*a*c + sqr
t(b^2 - 4*a*c)*(2*c*x +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2 + b*x + a))/(a*b^4*c^3 - 8*a^2*
b^2*c^4 + 16*a^3*c^5 + (b^4*c^4 - 8*a*b^2*c^5 + 16*a^2*c^6)*x^2 + (b^5*c^3 - 8*a*b^3*c^4 + 16*a^2*b*c^5)*x)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 2966 vs. \(2 (291) = 582\).

Time = 156.09 (sec) , antiderivative size = 2966, normalized size of antiderivative = 10.30 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\text {Too large to display} \]

[In]

integrate((e*x+d)**2*(h*x**2+g*x+f)/(c*x**2+b*x+a)**2,x)

[Out]

(-e*(2*b*e*h - 2*c*d*h - c*e*g)/(2*c**3) - sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**2*h - 12*a*b**2*c*e**2*h
+ 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h -
 2*b**3*c*d*e*h - b**3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(2*c**3*(64*a**3*c**3 - 48
*a**2*b**2*c**2 + 12*a*b**4*c - b**6)))*log(x + (-10*a**2*b*c*e**2*h - 16*a**2*c**4*(-e*(2*b*e*h - 2*c*d*h - c
*e*g)/(2*c**3) - sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**2*h - 12*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h + 6*a*
b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b**3*c*e
**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(2*c**3*(64*a**3*c**3 - 48*a**2*b**2*c**2 + 12*a*b**
4*c - b**6))) + 16*a**2*c**2*d*e*h + 8*a**2*c**2*e**2*g + 2*a*b**3*e**2*h + 8*a*b**2*c**3*(-e*(2*b*e*h - 2*c*d
*h - c*e*g)/(2*c**3) - sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**2*h - 12*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h
+ 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b*
*3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(2*c**3*(64*a**3*c**3 - 48*a**2*b**2*c**2 + 12
*a*b**4*c - b**6))) - 2*a*b**2*c*d*e*h - a*b**2*c*e**2*g - 2*a*b*c**2*d**2*h - 4*a*b*c**2*d*e*g - 2*a*b*c**2*e
**2*f - b**4*c**2*(-e*(2*b*e*h - 2*c*d*h - c*e*g)/(2*c**3) - sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**2*h - 1
2*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3*e**2*f
 + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b**3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(2*c**3*
(64*a**3*c**3 - 48*a**2*b**2*c**2 + 12*a*b**4*c - b**6))) + b**2*c**2*d**2*g + 2*b**2*c**2*d*e*f - 2*b*c**3*d*
*2*f)/(12*a**2*c**2*e**2*h - 12*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*
a*c**3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b**3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d
*e*f - 4*c**4*d**2*f)) + (-e*(2*b*e*h - 2*c*d*h - c*e*g)/(2*c**3) + sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**
2*h - 12*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3
*e**2*f + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b**3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(
2*c**3*(64*a**3*c**3 - 48*a**2*b**2*c**2 + 12*a*b**4*c - b**6)))*log(x + (-10*a**2*b*c*e**2*h - 16*a**2*c**4*(
-e*(2*b*e*h - 2*c*d*h - c*e*g)/(2*c**3) + sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**2*h - 12*a*b**2*c*e**2*h +
 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h -
2*b**3*c*d*e*h - b**3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(2*c**3*(64*a**3*c**3 - 48*
a**2*b**2*c**2 + 12*a*b**4*c - b**6))) + 16*a**2*c**2*d*e*h + 8*a**2*c**2*e**2*g + 2*a*b**3*e**2*h + 8*a*b**2*
c**3*(-e*(2*b*e*h - 2*c*d*h - c*e*g)/(2*c**3) + sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**2*h - 12*a*b**2*c*e*
*2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**
2*h - 2*b**3*c*d*e*h - b**3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(2*c**3*(64*a**3*c**3
 - 48*a**2*b**2*c**2 + 12*a*b**4*c - b**6))) - 2*a*b**2*c*d*e*h - a*b**2*c*e**2*g - 2*a*b*c**2*d**2*h - 4*a*b*
c**2*d*e*g - 2*a*b*c**2*e**2*f - b**4*c**2*(-e*(2*b*e*h - 2*c*d*h - c*e*g)/(2*c**3) + sqrt(-(4*a*c - b**2)**3)
*(12*a**2*c**2*e**2*h - 12*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**
3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b**3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f
- 4*c**4*d**2*f)/(2*c**3*(64*a**3*c**3 - 48*a**2*b**2*c**2 + 12*a*b**4*c - b**6))) + b**2*c**2*d**2*g + 2*b**2
*c**2*d*e*f - 2*b*c**3*d**2*f)/(12*a**2*c**2*e**2*h - 12*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2
*g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b**3*c*e**2*g + 2*b
*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)) + (-3*a**2*b*c*e**2*h + 4*a**2*c**2*d*e*h + 2*a**2*c**2*e**2*g
 + a*b**3*e**2*h - 2*a*b**2*c*d*e*h - a*b**2*c*e**2*g + a*b*c**2*d**2*h + 2*a*b*c**2*d*e*g + a*b*c**2*e**2*f -
 2*a*c**3*d**2*g - 4*a*c**3*d*e*f + b*c**3*d**2*f + x*(2*a**2*c**2*e**2*h - 4*a*b**2*c*e**2*h + 6*a*b*c**2*d*e
*h + 3*a*b*c**2*e**2*g - 2*a*c**3*d**2*h - 4*a*c**3*d*e*g - 2*a*c**3*e**2*f + b**4*e**2*h - 2*b**3*c*d*e*h - b
**3*c*e**2*g + b**2*c**2*d**2*h + 2*b**2*c**2*d*e*g + b**2*c**2*e**2*f - b*c**3*d**2*g - 2*b*c**3*d*e*f + 2*c*
*4*d**2*f))/(4*a**2*c**4 - a*b**2*c**3 + x**2*(4*a*c**5 - b**2*c**4) + x*(4*a*b*c**4 - b**3*c**3)) + e**2*h*x/
c**2

Maxima [F(-2)]

Exception generated. \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((e*x+d)^2*(h*x^2+g*x+f)/(c*x^2+b*x+a)^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` f
or more deta

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 547, normalized size of antiderivative = 1.90 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {e^{2} h x}{c^{2}} - \frac {{\left (4 \, c^{4} d^{2} f - 4 \, b c^{3} d e f + 4 \, a c^{3} e^{2} f - 2 \, b c^{3} d^{2} g + 8 \, a c^{3} d e g + b^{3} c e^{2} g - 6 \, a b c^{2} e^{2} g + 4 \, a c^{3} d^{2} h + 2 \, b^{3} c d e h - 12 \, a b c^{2} d e h - 2 \, b^{4} e^{2} h + 12 \, a b^{2} c e^{2} h - 12 \, a^{2} c^{2} e^{2} h\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{{\left (b^{2} c^{3} - 4 \, a c^{4}\right )} \sqrt {-b^{2} + 4 \, a c}} + \frac {{\left (c e^{2} g + 2 \, c d e h - 2 \, b e^{2} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, c^{3}} - \frac {\frac {{\left (2 \, c^{4} d^{2} f - 2 \, b c^{3} d e f + b^{2} c^{2} e^{2} f - 2 \, a c^{3} e^{2} f - b c^{3} d^{2} g + 2 \, b^{2} c^{2} d e g - 4 \, a c^{3} d e g - b^{3} c e^{2} g + 3 \, a b c^{2} e^{2} g + b^{2} c^{2} d^{2} h - 2 \, a c^{3} d^{2} h - 2 \, b^{3} c d e h + 6 \, a b c^{2} d e h + b^{4} e^{2} h - 4 \, a b^{2} c e^{2} h + 2 \, a^{2} c^{2} e^{2} h\right )} x}{c} + \frac {b c^{3} d^{2} f - 4 \, a c^{3} d e f + a b c^{2} e^{2} f - 2 \, a c^{3} d^{2} g + 2 \, a b c^{2} d e g - a b^{2} c e^{2} g + 2 \, a^{2} c^{2} e^{2} g + a b c^{2} d^{2} h - 2 \, a b^{2} c d e h + 4 \, a^{2} c^{2} d e h + a b^{3} e^{2} h - 3 \, a^{2} b c e^{2} h}{c}}{{\left (c x^{2} + b x + a\right )} {\left (b^{2} - 4 \, a c\right )} c^{2}} \]

[In]

integrate((e*x+d)^2*(h*x^2+g*x+f)/(c*x^2+b*x+a)^2,x, algorithm="giac")

[Out]

e^2*h*x/c^2 - (4*c^4*d^2*f - 4*b*c^3*d*e*f + 4*a*c^3*e^2*f - 2*b*c^3*d^2*g + 8*a*c^3*d*e*g + b^3*c*e^2*g - 6*a
*b*c^2*e^2*g + 4*a*c^3*d^2*h + 2*b^3*c*d*e*h - 12*a*b*c^2*d*e*h - 2*b^4*e^2*h + 12*a*b^2*c*e^2*h - 12*a^2*c^2*
e^2*h)*arctan((2*c*x + b)/sqrt(-b^2 + 4*a*c))/((b^2*c^3 - 4*a*c^4)*sqrt(-b^2 + 4*a*c)) + 1/2*(c*e^2*g + 2*c*d*
e*h - 2*b*e^2*h)*log(c*x^2 + b*x + a)/c^3 - ((2*c^4*d^2*f - 2*b*c^3*d*e*f + b^2*c^2*e^2*f - 2*a*c^3*e^2*f - b*
c^3*d^2*g + 2*b^2*c^2*d*e*g - 4*a*c^3*d*e*g - b^3*c*e^2*g + 3*a*b*c^2*e^2*g + b^2*c^2*d^2*h - 2*a*c^3*d^2*h -
2*b^3*c*d*e*h + 6*a*b*c^2*d*e*h + b^4*e^2*h - 4*a*b^2*c*e^2*h + 2*a^2*c^2*e^2*h)*x/c + (b*c^3*d^2*f - 4*a*c^3*
d*e*f + a*b*c^2*e^2*f - 2*a*c^3*d^2*g + 2*a*b*c^2*d*e*g - a*b^2*c*e^2*g + 2*a^2*c^2*e^2*g + a*b*c^2*d^2*h - 2*
a*b^2*c*d*e*h + 4*a^2*c^2*d*e*h + a*b^3*e^2*h - 3*a^2*b*c*e^2*h)/c)/((c*x^2 + b*x + a)*(b^2 - 4*a*c)*c^2)

Mupad [B] (verification not implemented)

Time = 15.07 (sec) , antiderivative size = 742, normalized size of antiderivative = 2.58 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {\frac {-3\,h\,a^2\,b\,c\,e^2+4\,h\,a^2\,c^2\,d\,e+2\,g\,a^2\,c^2\,e^2+h\,a\,b^3\,e^2-2\,h\,a\,b^2\,c\,d\,e-g\,a\,b^2\,c\,e^2+h\,a\,b\,c^2\,d^2+2\,g\,a\,b\,c^2\,d\,e+f\,a\,b\,c^2\,e^2-2\,g\,a\,c^3\,d^2-4\,f\,a\,c^3\,d\,e+f\,b\,c^3\,d^2}{c\,\left (4\,a\,c-b^2\right )}+\frac {x\,\left (2\,h\,a^2\,c^2\,e^2-4\,h\,a\,b^2\,c\,e^2+6\,h\,a\,b\,c^2\,d\,e+3\,g\,a\,b\,c^2\,e^2-2\,h\,a\,c^3\,d^2-4\,g\,a\,c^3\,d\,e-2\,f\,a\,c^3\,e^2+h\,b^4\,e^2-2\,h\,b^3\,c\,d\,e-g\,b^3\,c\,e^2+h\,b^2\,c^2\,d^2+2\,g\,b^2\,c^2\,d\,e+f\,b^2\,c^2\,e^2-g\,b\,c^3\,d^2-2\,f\,b\,c^3\,d\,e+2\,f\,c^4\,d^2\right )}{c\,\left (4\,a\,c-b^2\right )}}{c^3\,x^2+b\,c^2\,x+a\,c^2}+\frac {\ln \left (c\,x^2+b\,x+a\right )\,\left (-128\,h\,a^3\,b\,c^3\,e^2+64\,g\,a^3\,c^4\,e^2+128\,d\,h\,a^3\,c^4\,e+96\,h\,a^2\,b^3\,c^2\,e^2-48\,g\,a^2\,b^2\,c^3\,e^2-96\,d\,h\,a^2\,b^2\,c^3\,e-24\,h\,a\,b^5\,c\,e^2+12\,g\,a\,b^4\,c^2\,e^2+24\,d\,h\,a\,b^4\,c^2\,e+2\,h\,b^7\,e^2-g\,b^6\,c\,e^2-2\,d\,h\,b^6\,c\,e\right )}{2\,\left (64\,a^3\,c^6-48\,a^2\,b^2\,c^5+12\,a\,b^4\,c^4-b^6\,c^3\right )}+\frac {\mathrm {atan}\left (\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}-\frac {b^3\,c^2-4\,a\,b\,c^3}{c^2\,{\left (4\,a\,c-b^2\right )}^{3/2}}\right )\,\left (-12\,h\,a^2\,c^2\,e^2+12\,h\,a\,b^2\,c\,e^2-12\,h\,a\,b\,c^2\,d\,e-6\,g\,a\,b\,c^2\,e^2+4\,h\,a\,c^3\,d^2+8\,g\,a\,c^3\,d\,e+4\,f\,a\,c^3\,e^2-2\,h\,b^4\,e^2+2\,h\,b^3\,c\,d\,e+g\,b^3\,c\,e^2-2\,g\,b\,c^3\,d^2-4\,f\,b\,c^3\,d\,e+4\,f\,c^4\,d^2\right )}{c^3\,{\left (4\,a\,c-b^2\right )}^{3/2}}+\frac {e^2\,h\,x}{c^2} \]

[In]

int(((d + e*x)^2*(f + g*x + h*x^2))/(a + b*x + c*x^2)^2,x)

[Out]

((2*a^2*c^2*e^2*g - 2*a*c^3*d^2*g + b*c^3*d^2*f + a*b^3*e^2*h + a*b*c^2*e^2*f + a*b*c^2*d^2*h - a*b^2*c*e^2*g
- 3*a^2*b*c*e^2*h + 4*a^2*c^2*d*e*h - 4*a*c^3*d*e*f + 2*a*b*c^2*d*e*g - 2*a*b^2*c*d*e*h)/(c*(4*a*c - b^2)) + (
x*(2*c^4*d^2*f + b^4*e^2*h + b^2*c^2*e^2*f + 2*a^2*c^2*e^2*h + b^2*c^2*d^2*h - 2*a*c^3*e^2*f - 2*a*c^3*d^2*h -
 b*c^3*d^2*g - b^3*c*e^2*g + 3*a*b*c^2*e^2*g - 4*a*b^2*c*e^2*h + 2*b^2*c^2*d*e*g - 4*a*c^3*d*e*g - 2*b*c^3*d*e
*f - 2*b^3*c*d*e*h + 6*a*b*c^2*d*e*h))/(c*(4*a*c - b^2)))/(a*c^2 + c^3*x^2 + b*c^2*x) + (log(a + b*x + c*x^2)*
(2*b^7*e^2*h + 64*a^3*c^4*e^2*g - b^6*c*e^2*g - 24*a*b^5*c*e^2*h + 128*a^3*c^4*d*e*h + 12*a*b^4*c^2*e^2*g - 12
8*a^3*b*c^3*e^2*h - 2*b^6*c*d*e*h - 48*a^2*b^2*c^3*e^2*g + 96*a^2*b^3*c^2*e^2*h + 24*a*b^4*c^2*d*e*h - 96*a^2*
b^2*c^3*d*e*h))/(2*(64*a^3*c^6 - b^6*c^3 + 12*a*b^4*c^4 - 48*a^2*b^2*c^5)) + (atan((2*c*x)/(4*a*c - b^2)^(1/2)
 - (b^3*c^2 - 4*a*b*c^3)/(c^2*(4*a*c - b^2)^(3/2)))*(4*c^4*d^2*f - 2*b^4*e^2*h - 12*a^2*c^2*e^2*h + 4*a*c^3*e^
2*f + 4*a*c^3*d^2*h - 2*b*c^3*d^2*g + b^3*c*e^2*g - 6*a*b*c^2*e^2*g + 12*a*b^2*c*e^2*h + 8*a*c^3*d*e*g - 4*b*c
^3*d*e*f + 2*b^3*c*d*e*h - 12*a*b*c^2*d*e*h))/(c^3*(4*a*c - b^2)^(3/2)) + (e^2*h*x)/c^2